<?php session_start() ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Kalamazoo Animal Rescue - Add/Edit an Event</TITLE>

<META NAME="Author" CONTENT="Cayce Wilcox-York - York Systems Group">
<META HTTP-EQUIV="Expires" CONTENT="Saturday, 20 November 2004 08:00:00 GMT">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#800000">
<H2 align="left">KAR Internet Administration<br>Add/Edit An Event</H2>
  <br>

<?php

include("db.php");
				// Connect to the database server
dbConnect('kar_web1');   	// Use function in db.php to connect

echo("Use the html code below, inserting the proper Event ID where the \"19\" is, to display a link for the public which will take them to a page showing the pets scheduled for an event.  The public will have no other way to see a full list of scheduled pets unless the link is posted on an unprotected page on the web site.");

echo("<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;phpprod/sched2.php?eventID=19&quot;&gt;Pets Scheduled to Appear&lt;/a&gt; <BR><BR>");


echo("<HR><BR>");

$result = @mysql_query("SELECT eventID, eventName, eventDate, eventBeginTime, eventEndTime 
				   FROM events 
			    	   ORDER BY eventDate DESC") or
				die("Error getting events. ".mysql_error());

echo("<a href='event2.php'><font size=\"+1\">Add new event</font></a><BR><BR>");
 echo("<p>Select the event name to edit that event. </p>");
echo("<TABLE border cellpadding=5 >");

$num_rows = mysql_num_rows($result);

  echo("<TR bgcolor=\"#cccccc\"><TD><B>ID</B></TD><TD><B>Name</B></TD><TD><B>Date</B></TD>");
  echo("<TD><B>Start</B></TD><TD><B>Stop</B></TD></TR>");

while ( $row = mysql_fetch_array($result) ) {
  $temp_id = $row["eventID"];
  $eventBeginTime = $row["eventBeginTime"];
  $eventEndTime = $row["eventEndTime"];
  $eventDate = $row["eventDate"];

		list($a_hour, $a_minute, $a_second) = explode(":", $eventBeginTime); 
		if ($a_hour >12) 
			{ $a_ampm='pm';
			  $a_hour = $a_hour-12;
			}
		   else
			{ $a_ampm='am';
			}

		list($d_hour, $d_minute, $d_second) = explode(":", $eventEndTime); 
		if ($d_hour>12) 
			{ $d_ampm='pm';
			  $d_hour = $d_hour-12;
			}
		   else
			{ $d_ampm='am';
			}


  echo("<TR><TD>");
  echo($temp_id . "</TD><TD>");
  echo(" <a href='event2.php?event=$temp_id&update=1'>".$row["eventName"]."</a></TD>" );

  echo("<TD>".$eventDate);
  echo("</TD><TD>".$a_hour.":".$a_minute." ".$a_ampm."</TD><TD>".$d_hour.":".$d_minute." ".$d_ampm."</TD></TR>");
}

echo("</TABLE>");



    echo("<p>Back to  <a href='admin.htm'>Admin Page</a></p>");



?>




</body>
</html>